<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="common/include :: header('新增员工')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-dept-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">姓名：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="name"  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">邮箱：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="email" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">年龄：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="age">
            </div>
        </div>
      <!--  <div class="form-group">
            <label class="col-sm-3 control-label">预约时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="appointmentTime" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text" required>
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">所在部门：</label>
            <div class="col-sm-8">
                <select name="deptId" class="form-control m-b"  th:with="type=${@dept.list()}">
                    <option value="">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.name}"
                            th:value="${dict.id}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否是管理员：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_user_admin')}">
                    <input type="radio" th:id="${dict.id}" name="admin" th:value="${dict.value}" th:checked="${dict.isDefault}">
                    <label th:for="${dict.id}" th:text="${dict.label}"></label>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="common/include :: footer" />
<th:block th:include="common/include :: datetimepicker" />
<script type="text/javascript">
    var prefix = ctx + "/business/employee";
    $("#form-dept-add").validate({
        onkeyup: false,
      /*  rules:{
            name:{
                remote: {
                    url: prefix + "/checkDeptNameUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "parentId": function() {
                            return $("input[name='parentId']").val();
                        },
                        "name" : function() {
                            return $.common.trim($("#deptName").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            seq:{
                digits:true
            },
            email:{
                email:true,
            },
            phone:{
                isPhone:true,
            },
        },*/
        /*messages: {
            "name": {
                remote: "部门已经存在"
            }
        },*/
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
        }
    }
    // 绑定事件
    $("input[name='appointmentTime']").datetimepicker({
        format: "yyyy-mm-dd hh:ii",
        autoclose: true
    });

    /*function doSubmit(index, layero){
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }*/
</script>
</body>
</html>
